<?php 
$test='just for test';
$pnr_view="THIS IS INTERNET ORIGINATED PNR
F 1.1TESTERE/AEAEAEMR 2.1TESTERE/AEAEAEMR
3.1TESTERE/AEAEAEMSTR 4.1TESTERE/AEAEAEMSTR
XPDTKWS/WEB 11JUL RH6SBW
 1 TK2958 H  MO 11JUL  SAWESB HK4 X 2000 2100 CABIN YE
 2 TK7068 T  MO 11JUL  ESBTZX HK4   2245 0005*CABIN YE
  ANADOLUJET IS A TRADEMARK OF TURKISH AIRLINES
 3 TK7069 T  TU 12JUL  TZXESB HK4 X 0730 0850 CABIN YE
  ANADOLUJET IS A TRADEMARK OF TURKISH AIRLINES
 4 TK2127 H  TU 12JUL  ESBIST HK4   1000 1105 CABIN YE
FQ-1-2 QD11JUL11 D    ET WS/GS HTTH XPD
2.IST TK X/ANK TK TZX232.00H TK X/ANK TK IST232.00H
3.FARE TRY 464.00TAX TOT XT 110.00 TOT TRY 574.00
4. TAX    VQ     10.00 TAX    YR    100.00
5.S1-4 B20K
6.E KDV DAHIL 86.03TRY
7.E TKM:15.00TRY/TBU:589.00TRY
8.3-4 QD11JUL11 D    ET WS/GS HTTH XPD
9.IST TK X/ANK TK TZX174.00HCH TK X/ANK TK IST174.00HCH
10.FARE TRY 348.00TAX TOT XT 110.00 TOT TRY 458.00
11. TAX    VQ     10.00 TAX    YR    100.00
12.S1-4 B20K
13.E KDV DAHIL 68.34TRY
14.E TKM:15.00TRY/TBU:473.00TRY
FONE-XPD00-P 050512344321
2.XPD00-E DH@DRUPALHIZMETLERI.COM
3.XPD00-M 050512344321
4.1 XPD00-A UEIAUEI
5.1 XPD00-K 00
6.2 XPD00-A UEIAUEI
7.2 XPD00-K 00
8.3 XPD00-A UEIAUEI
9.3 XPD00-K 00
10.4 XPD00-A UEIAUEI
11.4 XPD00-K 00
PYMT-M-/WEB
TKT-3-4 G CHD
2.Y11JULXPDWS 2352411808015/16/17/18
AP FAX-1 S1 ZZRTKNETKHK1 2352411808015C1
2.1 S2 ZZRTKNETKHK1 2352411808015C2
3.1 S3 ZZRTKNETKHK1 2352411808015C3
4.1 S4 ZZRTKNETKHK1 2352411808015C4
5.1 S1 ZZRTKNETKHK1 2352411808016C1
6.1 S2 ZZRTKNETKHK1 2352411808016C2
7.1 S3 ZZRTKNETKHK1 2352411808016C3
8.1 S4 ZZRTKNETKHK1 2352411808016C4
9.1 S1 ZZRTKNETKHK1 2352411808017C1
10.1 S2 ZZRTKNETKHK1 2352411808017C2
11.1 S3 ZZRTKNETKHK1 2352411808017C3
12.1 S4 ZZRTKNETKHK1 2352411808017C4
13.1 S1 SSRTKNETKHK1 2352411808018C1
14.1 S2 SSRTKNETKHK1 2352411808018C2
15.1 S3 SSRTKNETKHK1 2352411808018C3
16.1 S4 SSRTKNETKHK1 2352411808018C4
RMKS-  MASTER XPDWSGS11JUL
2. .. ET/ELECTRONIC COMMERCE XPDWSGS11JUL
3. ..IRC-2/LAST TKT TLT-ADV OTO TKT OR XX BY 11JUL/1900 TRPTRRC11JUL";


$pnr_view="THIS IS INTERNET ORIGINATED PNR
F 1.1TESTERE/AEAEAEMR 2.1TESTERE/AEAEAEMR
3.I/1TESTERE/AEAEAAMSTR 4.I/1TESTERE/AEAEABMSTR
XPDTKWS/WEB 11JUL S3K8P3
 1 TK2178 H  MO 11JUL  ISTESB HK2   2000 2105 CABIN YE
FQ-1-2 QD11JUL11 D    ET WS/GS H XPD
2.IST TK ANK208.00H
3.FARE TRY 208.00TAX TOT XT 31.00 TOT TRY 239.00
4. TAX    VQ      6.00 TAX    YR     25.00
5.S1 B20K
6.E KDV DAHIL 35.54TRY
7.E TKM:15.00TRY/TBU:254.00TRY
8.3-4 QD11JUL11 D    ET WS/GS H XPD
9.IST TK ANK20.80HINF
10.FARE TRY 21.00
11.S1 B10K
12.E KDV DAHIL 3.20TRY
FONE-XPD00-P 050512344321
2.XPD00-E DH@DRUPALHIZMETLERI.COM
3.XPD00-M 050512344321
4.1 XPD00-A UEIAUEI
5.1 XPD00-K 00
6.2 XPD00-A UEIAUEI
7.2 XPD00-K 00
8.3 XPD00-A UEIAUEI
9.3 XPD00-K 00
10.4 XPD00-A UEIAUEI
11.4 XPD00-K 00
PYMT-M-/WEB
TKT-Y11JULXPDWS 2352411808011/12/13/14
AP FAX-1 S1 SSRINFTTKHK1 TESTERE/AEAEAAMSTR 09MAY11
2.2 S1 SSRINFTTKHK1 TESTERE/AEAEABMSTR 16MAY11
3.1 S1 ZZRTKNETKHK1 2352411808011C1
4.1 S1 SSRTKNETKHK1 2352411808012C1
5.1 S1 ZZRTKNETKHK1 INF2352411808013C1
6.1 S1 SSRTKNETKHK1 INF2352411808014C1
RMKS-  MASTER XPDWSGS11JUL
2. .. ET/ELECTRONIC COMMERCE XPDWSGS11JUL
3. ..IRC-2/DVD OR ADV MORE TKT OR XX BY 11JUL/1509 TRPTRRC11JUL";



$pnr_view2="THIS IS INTERNET ORIGINATED PNR
F 1.1RA/ALIMR 2.1RA/VELIMR 3.1RA/BEKIRMSTR 4.I/1RA/TEKIRMSTR
XPDTKWS/WEB 14JUL RH6SIQ
1 TK2631 B  FR 15JUL  MLXIST HK3 X 0905 1050 CABIN YE
2 TK2586 V  FR 15JUL  ISTCKZ HK3   2250 2355 CABIN YE
3 TK9061 V  SA 16JUL  CKZSAW HK3 X 1000 1100 CABIN YE*YB FLT
ANADOLUJET TRADE MARK FLT/OPERATED BORAJET*YB0182V
4 TK2636 V  SA 16JUL  ISTMLX HK3   1840 2020 CABIN YE
FQ-1-2 QD14JUL11 D    ET WS/GS BVVV XPD
2.MLX TK X/IST TK CKZ282.00B TK X/IST TK MLX97.00V
3.FARE TRY 379.00TAX TOT XT 106.00 TOT TRY 485.00
4. TAX    VQ      6.00 TAX    YR    100.00
5.S1-4 B20K
6.E KDV DAHIL 73.07TRY
7.E TKM:25.00TRY/TBU:510.00TRY
8.3 QD14JUL11 D    ET WS/GS BVVV XPD
9.MLX TK X/IST TK CKZ211.50BCH TK X/IST TK MLX72.75VCH
10.FARE TRY 285.00TAX TOT XT 106.00 TOT TRY 391.00
11. TAX    VQ      6.00 TAX    YR    100.00
12.S1-4 B20K
13.E KDV DAHIL 58.73TRY
14.E TKM:25.00TRY/TBU:416.00TRY
15.4 QD14JUL11 D    ET WS/GS BVVV XPD
16.MLX TK X/IST TK CKZ28.20BINF TK X/IST TK MLX9.70VINF
17.FARE TRY 38.00
18.S1-4 B10K
19.E KDV DAHIL 5.80TRY
FONE-XPD00-P 050512344321
2.XPD00-E INFO@OTEM.COM.TR
3.XPD00-M 050512344321
4.1 XPD00-A RTTYRT
5.1 XPD00-K 00
6.2 XPD00-A RTTYRT
7.2 XPD00-K 00
8.3 XPD00-A RTTYRT
9.3 XPD00-K 00
10.4 XPD00-A RTTYRT
11.4 XPD00-K 00
PYMT-M-/WEB
TKT-3 G CHD
2.Y14JULXPDWS 2352411808075-76/77-78/79-80/81-82
AP FAX-1 S1 SSRINFTTKHK1 RA/TEKIRMSTR 05JUL11
2.1 S2 SSRINFTTKHK1 RA/TEKIRMSTR 05JUL11
3.1 S3 SSRINFTTKHK1 RA/TEKIRMSTR 05JUL11
4.1 S4 SSRINFTTKHK1 RA/TEKIRMSTR 05JUL11
5.1 S1 SSRTKNETKHK1 2352411808075C1/075-076
6.1 S2 SSRTKNETKHK1 2352411808075C2/075-076
7.1 S3 SSRTKNETKHK1 2352411808075C3/075-076
8.1 S4 SSRTKNETKHK1 2352411808076C1/075-076
9.2 S1 SSRTKNETKHK1 2352411808077C1/077-078
10.2 S2 SSRTKNETKHK1 2352411808077C2/077-078
11.2 S3 SSRTKNETKHK1 2352411808077C3/077-078
12.2 S4 SSRTKNETKHK1 2352411808078C1/077-078
13.3 S1 SSRTKNETKHK1 2352411808079C1/079-080
14.3 S2 SSRTKNETKHK1 2352411808079C2/079-080
15.3 S3 SSRTKNETKHK1 2352411808079C3/079-080
16.3 S4 SSRTKNETKHK1 2352411808080C1/079-080
17.1 S1 SSRTKNETKHK1 INF2352411808081C1/081-082
18.1 S2 SSRTKNETKHK1 INF2352411808081C2/081-082
19.1 S3 SSRTKNETKHK1 INF2352411808081C3/081-082
20.1 S4 SSRTKNETKHK1 INF2352411808082C1/081-082
RMKS-  OTEM.BILETLEGELSIN.COM XPDWSGS14JUL
2. .. ET/ELECTRONIC COMMERCE XPDWSGS14JUL";



$pnr_view="THIS IS INTERNET ORIGINATED PNR
F 1.1TYI/RETERMR 2.1TYI/NHYMR 3.1TYI/OPIUIOUMSTR
4.I/1TYI/SJGHJKHMSTR
XPDTKWS/WEB 20JUL R8SFYJ
 1 TK7065 O  TH 21JUL  TZXESB HK3 X 1120 1240 CABIN YE
  ANADOLUJET IS A TRADEMARK OF TURKISH AIRLINES
 2 TK7004 O  TH 21JUL  ESBADB HK3   1425 1545 CABIN YE
  ANADOLUJET IS A TRADEMARK OF TURKISH AIRLINES
FQ-1 QD20JUL11 D    ET WS/GS OO XPD
2.TZX TK X/ANK TK IZM47.00O
3.FARE TRY 47.00TAX TOT XT 54.00 TOT TRY 101.00
4. TAX    VQ      4.00 TAX    YR     50.00
5.S1-2 B15K
6.E KDV DAHIL 14.80TRY
7.E TKM:10.00TRY/TBU:111.00TRY
8.E IADE/DEGISIKLIK YAPILMAZ
9.2 QD20JUL11 D    ET WS/GS OO XPD
10.TZX TK X/ANK TK IZM47.00O
11.FARE TRY 47.00TAX TOT XT 54.00 TOT TRY 101.00
12. TAX    VQ      4.00 TAX    YR     50.00
13.S1-2 B15K
14.E KDV DAHIL 14.80TRY
15.E TKM:10.00TRY/TBU:111.00TRY
16.E IADE/DEGISIKLIK YAPILMAZ
17.3 QD20JUL11 D    ET WS/GS OO XPD
18.TZX TK X/ANK TK IZM47.00OCH
19.FARE TRY 47.00TAX TOT XT 54.00 TOT TRY 101.00
20. TAX    VQ      4.00 TAX    YR     50.00
21.S1-2 B15K
22.E KDV DAHIL 14.80TRY
23.E TKM:10.00TRY/TBU:111.00TRY
24.E IADE/DEGISIKLIK YAPILMAZ
25.4 QD20JUL11 D    ET WS/GS OO XPD
26.TZX TK X/ANK TK IZM4.70OINF
27.FARE TRY 5.00
28.S1-2 B10K
29.E KDV DAHIL
30.E IADE/DEGISIKLIK YAPILMAZ
FONE-XPD00-P 050512344321
2.XPD00-E INFO@OTEM.COM.TR
3.XPD00-M 050512344321
4.1 XPD00-A HGJTGJG
5.1 XPD00-K 00
6.2 XPD00-A HGJTGJG
7.2 XPD00-K 00
8.3 XPD00-A HGJTGJG
9.3 XPD00-K 00
10.4 XPD00-A HGJTGJG
11.4 XPD00-K 00
PYMT-M-/WEB
TKT-3 G CHD
2.Y20JULXPDWS 2352411808106/07/08/09
AP FAX-1 SSRWCHRYYHK1
2.2 SSRBLGKTKHK1 YASLI IND
3.2 SSRWCHRYYHK1
4.3 SSRWCHRYYHK1
5.1 S1 SSRINFTTKHK1 TYI/SJGHJKHMSTR 01JUL11
6.1 S2 SSRINFTTKHK1 TYI/SJGHJKHMSTR 01JUL11
7.1 S1 SSRTKNETKHK1 2352411808106C1
8.1 S2 SSRTKNETKHK1 2352411808106C2
9.2 S1 SSRTKNETKHK1 2352411808107C1
10.2 S2 SSRTKNETKHK1 2352411808107C2
11.3 S1 SSRTKNETKHK1 2352411808108C1
12.3 S2 SSRTKNETKHK1 2352411808108C2
13.1 S1 SSRTKNETKHK1 INF2352411808109C1
14.1 S2 SSRTKNETKHK1 INF2352411808109C2
RMKS-  OTEM.BILETLEGELSIN.COM XPDWSGS20JUL
2. .. ET/ELECTRONIC COMMERCE XPDWSGS20JUL";

$pnr_view1 = "THIS IS INTERNET ORIGINATED PNR
F 1.1VELI/ALIMR 2.1VELI/AYSEMR 3.I/1VELI/BEBEKMSTR
XPDTKWS/WEB 11SEP SMTHYI
 1 TK7002 O  MO 26SEP  ESBADB HK2   0940 1100 CABIN YE
  ANADOLUJET IS A TRADEMARK OF TURKISH AIRLINES
FQ-1 QD12SEP11 D    ET WS/GS O XPD
2.ANK TK IZM23.00OCIP
3.FARE TRY 23.00TAX TOT XT 56.00 TOT TRY 79.00
4. TAX    VQ      6.00 TAX    YR     25.00 TAX    DV     25.00
5.S1 B15K
6.E KDV DAHIL 11.14TRY
7.E TKM:10.00TRY/TBU:89.00TRY
8.E IADE/DEGISIKLIK YAPILMAZ
9.2 QD12SEP11 D    ET WS/GS O XPD
10.ANK TK IZM23.00OZSCIP
11.FARE TRY 23.00TAX TOT XT 56.00 TOT TRY 79.00
12. TAX    VQ      6.00 TAX    YR     25.00 TAX    DV     25.00
13.S1 B15K
14.E KDV DAHIL 11.14TRY
15.E TKM:10.00TRY/TBU:89.00TRY
16.E IADE/DEGISIKLIK YAPILMAZ
17.3 QD12SEP11 D    ET WS/GS O XPD
18.ANK TK IZM2.30OINF
19.FARE TRY 3.00
20.S1 B10K
21.E KDV DAHIL
22.E IADE/DEGISIKLIK YAPILMAZ
FONE-XPD00-P 0(111) 111-1111
2.XPD00-E INFO@OTEM.COM.TR
3.XPD00-M 050512344321
4.1 XPD00-A HGGHFHGF
5.1 XPD00-K 00
6.2 XPD00-A HGGHFHGF
7.2 XPD00-K 00
8.3 XPD00-A HGGHFHGF
9.3 XPD00-K 00
PYMT-M-/WEB
TKT-2 G ZS
2.Y11SEPXPDWS 2352411808153/54/55
AP FAX-2 SSRBLGKTKHK1 OGRENCI IND
2.1 S1 SSRINFTTKHK1 VELI/BEBEKMSTR 05SEP11
3.1 S1 SSRTKNETKHK1 2352411808153C1
4.2 S1 SSRTKNETKHK1 2352411808154C1
5.1 S1 SSRTKNETKHK1 INF2352411808155C1
RMKS-  OTEM.BILETLEGELSIN.COM XPDWSGS11SEP
2. .. ET/ELECTRONIC COMMERCE XPDWSGS11SEP";


		$pax_cnt=0;		
		$pnr_arr = explode(chr(10),$pnr_view);
		$fares = array();
		for ($i=0; $i < count($pnr_arr);$i++) {
			$pnr_line = $pnr_arr[$i];
			if (strpos($pnr_line,'.FARE')>0) {
			  $pax_type = trim(substr($pnr_arr[$i-1],-3));
			  $pnr_line=substr($pnr_line,strpos($pnr_line,'FARE'));

			if ($pax_type === 'NF') {
				$fares[$pax_cnt++] = array('fare'=> substr($pnr_line,8), 'tax'=> 0, 'total'=> substr($pnr_line,8)); 
			} else {		
				$fares[$pax_cnt++] = array('fare'=> substr($pnr_line,8,strpos($pnr_line,'TAX')-8),
	  			        'tax'=> substr($pnr_line,strpos($pnr_line,'TOT XT')+6,7),
		  		        'total'=> substr($pnr_line,strpos($pnr_line,'TOT TR')+8));
			  }
		  }
		}



echo '<pre>';
print_r($fares);
echo '</pre>';

